package com.technology.education.ui.student.black_list

import androidx.lifecycle.MutableLiveData
import com.technology.education.data.model.TeacherBlackListModel
import com.technology.education.network.apiService
import me.hgj.jetpackmvvm.base.viewmodel.BaseViewModel
import me.hgj.jetpackmvvm.ext.request
import me.hgj.jetpackmvvm.state.ResultState

/**
 *@author:create by BZY
 *Date: 2022/3/11 08
 */
class BlackListViewModel : BaseViewModel() {
    val result = MutableLiveData<ResultState<TeacherBlackListModel>>()
    val delResult=MutableLiveData<String>()
    override fun getData() {
        super.getData()
        request({
            apiService.teacherBlackList(hashMapOf("pageNo" to pageSize, "pageSize" to pageIndex))
        }, result)
    }

    fun delBlack(id:String){
        request({ apiService.blackTeacher(hashMapOf("id" to id ,"state" to 0))},success = {
            delResult.postValue(id)
        })
    }
}